package com.tqz.rc.spring.cloud.example.provider;

import feign.hystrix.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * <p>
 *
 * @author tianqingzhao
 * @since 2021/9/22 10:34
 */
@FeignClient(path = "provider", value = "spring-cloud-starter-tqz-rc-example-provider",
        fallback = ProviderFeignClient.ProviderFeignClientFallback.class)
public interface ProviderFeignClient {

    @RequestMapping("test")
    String test(@RequestParam("name") String name);

    @Component
    static class ProviderFeignClientFallback implements ProviderFeignClient {

        @Override
        public String test(String name) {
            return "接口异常了。";
        }
    }
}
